package demo2;

public class Test {

    public static void main(String[] args) {
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        Triangle triangle = new Triangle();
        Flower flower = new Flower();


        Shape[] shapes = {cycle,rect,cycle,rect,triangle,flower};

        for(Shape shape : shapes) {
            shape.draw();
        }





        //Shape shape3 = cycle;



        /*for (int i = 0; i < shapes.length; i++) {
            Shape shape = shapes[i];
            shape.draw();
        }*/
    }


    public static void main4(String[] args) {
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        Triangle triangle = new Triangle();

        String[] strings = {"cycle","rect","cycle","rect","triangle"};

        for(String s :strings) {
            if(s.equals("cycle")) {
                cycle.draw();
            }else if(s.equals("rect")) {
                rect.draw();
            }else {
                triangle.draw();
            }
        }
    }




    public static void drawMap(Shape shape) {
        shape.draw();
    }

    public static void main1(String[] args) {
        Rect rect = new Rect();
        Cycle cycle = new Cycle();
        Triangle triangle = new Triangle();
        drawMap(rect);
        drawMap(cycle);
        drawMap(triangle);
    }
}